﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cwtrock.dao.impl;
using cwtrock.model;

namespace cwtrock.service.impl
{
    class VrecordsServiceImpl
    {
        private VrecordsDaoImpl vrecordsDaoImpl = new VrecordsDaoImpl();

        public int save(Vrecords vrecord) {

            return vrecordsDaoImpl.save(vrecord);
        }

        // 按条件查询凭证分录
        public List<Vrecords> getVrecordsByCondition(Vouchers vou) {
            return vrecordsDaoImpl.getVrecordsByCondition(vou);
        }

        // 按凭证id取得分录
        public List<Vrecords> getVrecordsByVouid(List<Vrecords> vrls, long vid)
        {
            if (vrls == null)
                return null;

            List<Vrecords> rtnls = new List<Vrecords>();
            foreach (Vrecords vou in vrls) {
                if (vou.Vid.Equals(vid))
                {
                    rtnls.Add(vou);
                
                }
            
            }


            return rtnls;
        }

        public int update(Vrecords vrecord) {
            return vrecordsDaoImpl.update(vrecord);
        }
    
    }
}
